//void, Obj owner

ObjList ol;
Unit u, this;
int i, nCount;

if (!owner.AsUnit.IsValid)
	return;
	
this = owner.AsUnit();
if( .InHolder )
{
	UserNotification("item cannot use in holder", "", owner.posRH, owner.player);
	return;
}

ol = ObjsInSight(this, "Unit").GetObjList();
nCount=0;

if (ol.count>0)
	for (i=0; ol.count!=0 && i<100 && nCount<12; i+=1) { //make 100 attempts to damage 
		u = ol[rand(ol.count)];
		if (u.IsDead()) continue;
		if (.IsEnemy(u)) {
			nCount+=1;
			CreateFeedback("Damage2", u);
			u.Damage(100);
			ol.Remove(u); //avoid damaging it twice
		}
	}

//if after 100 random attempts 12 enemies are not damaged, damage them in order
for (i=0; i<ol.count && nCount<12; i+=1) {
	u = ol[i];
	if (u.IsDead()) continue;
	if (.IsEnemy(u)) {
		nCount+=1;
		CreateFeedback("Damage2", u);
		u.Damage(100);
	}
}

ItemUsed(1);
Sleep(2000);
return;
